package com.example.administrator.yuejian23.Activity;

/**
 * Created by Administrator on 2017/11/1.
 */

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;

import com.example.administrator.yuejian23.Bean.MyBean;
import com.example.administrator.yuejian23.R;

import com.example.administrator.yuejian23.Activity.BaseActivity;
import com.example.administrator.yuejian23.Const;
import com.example.administrator.yuejian23.Retrofit.RetrofitService;
import com.squareup.picasso.Downloader;

import java.util.List;

import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;



public class MySettingInfoActivity extends BaseActivity {

    private int user_id;
    private EditText user_name;
    private EditText user_password;
    private Button butt1;
    private Button user_change2;
    String name;
    String password;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.item_info_set);
      /*  user_id=getUserId();*/
//        System.out.print(user_id);
//        user_name= (EditText) findViewById(user_change_name);
//        user_name.setText(user_id);
/*        user_change1= (Button) findViewById(R.id.user_change_button1);
        user_change2= (Button) findViewById(R.id.user_change_button2);
        user_name= (EditText) findViewById(R.id.user_change_name);
        user_password= (EditText) findViewById(R.id.user_change_password);*/
     /*   butt1.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                name=user_name.getText().toString();
                if (name.equals("")){
                    Toast.makeText(MySettingInfoActivity.this,"你的用户名不能为空",Toast.LENGTH_LONG).show();
                }else {
                    Retrofit retrofit=new Retrofit.Builder().addConverterFactory(GsonConverterFactory.create()).baseUrl(Const.BASE_URL).build();
                    RetrofitService services=retrofit.create(RetrofitService.class);
                    Call<MyBean> call=services.setName(user_id,name);
                    call.enqueue(new Callback<MyBean>() {
                        @Override
                        public void onResponse(Call<MyBean> call, Response<MyBean> response) {
                            if (response.body()==null){
                                Toast.makeText(MySettingInfoActivity.this,"用户名修改成功",Toast.LENGTH_LONG).show();
                            }else {
                                Toast.makeText(MySettingInfoActivity.this,"用户名修改shibai",Toast.LENGTH_LONG).show();
                            }
                        }


                        @Override
                        public void onFailure(Call<MyBean> call, Throwable t) {

                        }
                    });

                }
            }
        });*/

     /*   user_change2.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                password=user_password.getText().toString();
                if(password.equals("")){
                    Toast.makeText(MySettingInfoActivity.this,"您输入的密码为空",Toast.LENGTH_LONG).show();
                }else {
                    Retrofit retrofit=new Retrofit.Builder().addConverterFactory(GsonConverterFactory.create()).baseUrl(Const.BASE_URL).build();
                    RetrofitService services=retrofit.create(RetrofitService.class);
                    Call<MyBean>call=services.setPassword(user_id,password);
                    call.enqueue(new Callback<MyBean>() {
                        @Override
                        public void onResponse(Call<MyBean> call, Response<MyBean> response) {
                            if (response.body()==null){
                                Toast.makeText(MySettingInfoActivity.this,"密码修改成功",Toast.LENGTH_LONG).show();
                            }else {
                                Toast.makeText(MySettingInfoActivity.this,"密码修改shibai",Toast.LENGTH_LONG).show();
                            }
                        }

                        @Override
                        public void onFailure(Call<MyBean> call, Throwable t) {

                        }
                    });

                }
            }
        });*/
    }
}
